﻿#include<iostream>
#include<vector>
using namespace std;

//
// 二分查找算法
// 特点：注意细节，避免死循环，
// 
// 
// 理解模版
// 1.朴素的二分模版
// while(left <= right){
//             //int mid = (right + left) / 2;
//	int mid = left + (right - left) / 2;
//	if (...)
//		 right = mid - 1;
//	else if (...) 
//		 left = mid + 1;
//	else 
//		 return  mid;
//}
// 
// 2.查找左边界的二分模版
// while(left < right){
//  int  mid = left + (right - left) / 2;
// if(.....)left = mid + 1;
// else right = mid;
// }
// 3.查找右边界的二分模版
// while(left < right){
// int  mid = left + (right - left + 1) / 2;
// if(....) left = mid;
// else right = mid - 1;
// }
// 时间复杂度O(log2 N)
// 
// 
// 
// 
//



//二分查找
class Solution {
public:
    int search(vector<int>& nums, int target) {
        int n = nums.size();
        int left = 0;
        int right = n - 1;
        while (left <= right) {
            //int mid = (right + left) / 2;
            int mid = left + (right - left) / 2;
            if (target < nums[mid]) {
                right = mid - 1;
            }
            else if (target > nums[mid]) {
                left = mid + 1;
            }
            else {
                return  mid;
            }
        }
        return -1;
    }
};

//34. 在排序数组中查找元素的第一个和最后一个位置
class Solution {
public:
    vector<int> searchRange(vector<int>& nums, int target) {
        int n = nums.size();
        if (n == 0)return { -1, -1 };
        int left = 0, right = n - 1;
        int begin = 0;
        //求左端点
        while (left < right) {
            int mid = left + (right - left) / 2;
            if (nums[mid] < target) {
                left = mid + 1;
            }
            else if (nums[mid] >= target) {
                right = mid;
            }
        }
        if (nums[left] != target) return { -1,-1 };
        else begin = left;
        right = n - 1;
        //求右端点
        while (left < right) {
            int mid = left + (right - left + 1) / 2;
            if (nums[mid] <= target) {
                left = mid;
            }
            else right = mid - 1;
        }
        return{ begin,right };
    }
};

//69. x 的平方根 
class Solution {
public:
    int mySqrt(int x) {
        if (x < 1)return 0;
        int  l = 1, r = x;
        while (l < r) {
            long long mid = l + (r - l) / 2;
            if (mid * mid <= x) l = mid;
            else r = mid - 1;
        }
        return l;
    }
};

//35. 搜索插入位置
class Solution {
public:
    int searchInsert(vector<int>& nums, int target) {
        int left = 0, right = nums.size() - 1;
        //     int ret = nums.size();
        //     while(left <= right){
        //         int mid = left + (right - left) / 2;
        //         if(nums[mid] < target){
        //             left = mid + 1;
        //         }else{
        //             ret = mid;
        //             right = mid - 1;
        //         }
        //     }
        // return ret;
        while (left < right) {
            int mid = left + (right - left) / 2;
            if (nums[mid] < target)left = mid + 1;
            else right = mid;
        }
        if (nums[left] < target) return left + 1;
        return left;
    }
};

//852. 山脉数组的峰顶索引
class Solution {
public:
    int peakIndexInMountainArray(vector<int>& arr) {
        int n = arr.size();
        int left = 1, right = n - 2;
        while (left < right) {
            int mid = left + (right - left + 1) / 2;
            if (arr[mid] > arr[mid - 1])left = mid;
            else right = mid - 1;
        }
        return left;
    }
};

//162. 寻找峰值
class Solution {
public:
    int findPeakElement(vector<int>& nums) {
        int n = nums.size();
        int left = 0, right = n - 1;
        while (left < right) {
            int mid = left + (right - left) / 2;
            if (nums[mid] < nums[mid + 1]) left = mid + 1;
            else right = mid;
        }
        return left;
    }
};

//153. 寻找旋转排序数组中的最小值
class Solution {
public:
    int findMin(vector<int>& nums) {
        int n = nums.size();
        int left = 0, right = n - 1;
        while (left < right) {
            int mid = left + (right - left) / 2;
            if (nums[mid] > nums[right])left = mid + 1;
            else right = mid;
        }
        return nums[left];
    }
};

//剑指Offer53-II.0〜n-1中缺失的数字 / LCR 173. 点名
class Solution {
public:
    int takeAttendance(vector<int>& records) {
        //二分    
        int n = records.size();
        int left = 0, right = n - 1;
        while (left < right) {
            int mid = left + (right - left) / 2;
            if (records[mid] == mid)left = mid + 1;
            else right = mid;
        }
        return left == records[left] ? left + 1 : left;
        //位运算
            // int ret = 0;
            // for(int i = 0;i < records.size();i++){
            //     ret ^= records[i] ^ (i + 1);
            // }
            // return ret;
    }

};

#include <iostream>
using namespace std;
int L[100001];//长
int w[100001];//宽
int n, k;
bool isret(int r) {//判断边长是否满足
    int count = 0;
    for (int j = 0;j < n;j++) {
        count += (L[j] / r) * (w[j] / r);//计算当前边长切割数量
    }
    if (count >= k) {
        return  true;
    }
    return false;
}
int main()
{
    cin >> n >> k;
    for (int i = 0;i < n;i++)
        cin >> L[i] >> w[i];
    int min = 1;
    int max = 100000;
    int ret = 0;
    while (min <= max) {//二分找合适边长
        int mid = (min + max) / 2;
        if (isret(mid)) {
            ret = mid;
            min = mid + 1;
        }
        else
            max = mid - 1;
    }
    cout << ret;
    return 0;
}